package cn.itcast.zt.java8.disruptor;

import cn.hutool.json.JSONUtil;
import com.lmax.disruptor.EventHandler;
import com.lmax.disruptor.WorkHandler;

import java.util.UUID;

/**
 * 创建消费者，此处用于处理业务逻辑
 * @author zhangtian105
 * @date 2023/4/25
 * @apiNote
 */
public class NotifyEventHandler implements EventHandler<NotifyEvent> , WorkHandler<NotifyEvent> {
    @Override
    public void onEvent(NotifyEvent notifyEvent, long l, boolean b) throws Exception {
        System.out.println("接收到消息: notifyEvent: " + notifyEvent + ",l: " + l + ",b: " + b);
        this.onEvent(notifyEvent);
    }

    @Override
    public void onEvent(NotifyEvent notifyEvent) throws Exception {
        System.out.println("处理消息: "+notifyEvent + ">>>" + UUID.randomUUID().toString());
    }
}
